﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SocialPlatformSDK.Model;
using SocialPlatformSDK.Services;
using SocialPlatformSDK.Services.Util;
using SocialPlatformSDK.Util;

namespace SocialPlatformSDK
{
    public class SinaSocFactory : SocialFactoryBase<SinaSocFactory>
    {
        private IOAuthConfigruation _sinaOAuthConfig;
        private SinaAPIService<SinaServiceArgument> _sinaAPIService;
        public  void Init()
        {
            _sinaOAuthConfig = SinaOAuthInfo.Instance;
            _sinaOAuthConfig.Init();
            _sinaAPIService = new SinaAPIService<SinaServiceArgument>(_sinaOAuthConfig.AccessToken, _sinaOAuthConfig);

        }
        public override void Validate()
        {

            _sinaOAuthConfig.Validate();
        }

        public override void ClearAccessToken()
        {
            _sinaOAuthConfig.ClearAccessToken();
        }

        public override void SaveData(AccessToken token)
        {
            _sinaOAuthConfig.TokenIso.SaveData(token);
        }

        public override void SocialSharePublish(string channelName, string channelUrl, string message, SocialShareHandler callBack)
        {
            throw new NotImplementedException();
        }

        public SinaAPIService<SinaServiceArgument> GetAPIService()
        {
            _sinaAPIService = new SinaAPIService<SinaServiceArgument>(_sinaOAuthConfig.AccessToken, _sinaOAuthConfig);
            return _sinaAPIService;
        }
    }
}
